package com.thread.start;

/**
 * 线程暂停和线程终止
 *
 * @author jiangbang
 * @date 2016/6/17
 */
public class JoinDemo02 implements Runnable{

    public static void main(String[] args) throws InterruptedException {
        JoinDemo02 demo = new JoinDemo02();
        Thread thread = new Thread(demo);
        thread.start(); //就绪
        //cpu调度
        for(int i=0;i<100;i++){
            if(i%10==0){
                //thread.join(); //等待该线程终止。
                Thread.yield(); //暂停线程。
            }
            System.out.println("main.."+i);
        }

    }

    @Override
    public void run() {
        for(int i=0;i<100;i++){
            System.out.println("run.."+i);
        }
    }
}
